import EhRequest from "../index";
import { IAccount,IDataType,ILoginResult  } from "./types";
enum LoginAPI{
  AccountLogin = '/login',
  LoginUserInfo = '/users/',//users/id
  UserMenus = '/role/' //用法：role/1/menu
}
export function accountLoginRequest(account:IAccount){
  return EhRequest.post<IDataType<ILoginResult>>({
    url:LoginAPI.AccountLogin,
    data:account
  })
}
export function requestUserInfoById(id:number){
  return EhRequest.get<IDataType>({
    url:LoginAPI.LoginUserInfo+id
  })
}
export function requestUserMenusByRoleId(id:number){
  return EhRequest.get<IDataType>({
    url:LoginAPI.UserMenus + id + '/menu'
  })
}